package Day28.Demo06;

import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;

public class Demo01 {
    public static void main(String[] args) throws Exception {
        //内省
        Class c = Express.class;
        BeanInfo bi = Introspector.getBeanInfo(c);//获取一个bean信息
        PropertyDescriptor[] pds = bi.getPropertyDescriptors(); //获取bean类的 get/set方法 数组
        for (PropertyDescriptor pd:pds) {
            Method get = pd.getReadMethod();
            Method set = pd.getWriteMethod();//获取get  set方法
            System.out.println(get);
            System.out.println(set);
            System.out.println(pd.getName());
            System.out.println(pd.getPropertyType());//获取属性
        }
    }
}
